import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),],
  css: {
    preprocessorOptions: {
      scss: {
        charset: false
      }
    }
  },
  build: {
    minify: 'terser',
    terserOptions: {
      compress: {
        //生产环境时移除console
        drop_console: true,
        drop_debugger: true
      }
    }
  },
  resolve: {
    // 设置路径别名
    alias: {
      '@': resolve(__dirname, './src'),
      '*': resolve('')
    },
  },

  server: {
    // port: 8080,
    // host: true,
    host: "0.0.0.0",
    proxy: {
      //测试地址
      '/doctor-cheese': {
        // target: 'https://it.zmylclould.com:19000/doctor-cheese',
        target: 'http://177.19.100.2:17193/doctor-cheese',
        // target: 'https://it.zmylclould.com:19000/hw-debug',
        // target: 'http://177.19.10.134:17193/doctor-cheese',
        // target: 'http://177.19.100.2:17193/doctor-cheese',
        changeOrigin: true,
        pathRewrite: {
          '^/doctor-cheese': ''
        }
      },
      '/bpt': {
        // target: 'http://177.19.100.3:17101/bpt',
        target: 'https://it.zmylclould.com:18089/bpt',
        changeOrigin: true,
        pathRewrite: {
          '^/bpt': ''
        }
      },
      '/zmc': {
        target: 'https://it.zmylclould.com:18089/zmc',
        changeOrigin: true,
        pathRewrite: {
          '^/zmc': ''
        }
      },
      '/upload-server': {
        // target: 'http://177.19.120.100:17601/upload-server',
        target: 'https://it.zmylclould.com:18089/upload-server',
        changeOrigin: true,
        pathRewrite: {
          '^/upload-server': ''
        }
      },
      '/zhongmaoyunService': {
        target: 'https://it.zmylclould.com:18089/zhongmaoyunService',
        changeOrigin: true,
        pathRewrite: {
          '^/zhongmaoyunService': ''
        }
      },
      //切片信息测试地址
      '/slide-info': {
        target: 'https://it.zmylclould.com:19000',
        // target: 'http://177.19.100.2:17193/doctor-cheese',
        // target: 'https://it.zmylclould.com:19000/hw-debug',
        // target: 'http://177.19.10.134:17193/doctor-cheese',
        changeOrigin: true,
        pathRewrite: {
          '^/slide-info': ''
        }
      },
      //正式地址
      // '/zhongmaoyunService': {
      //   target: 'https://www.zmylschool.com//zhongmaoyunService',
      //   changeOrigin: true,
      //   pathRewrite: {
      //     '^/zhongmaoyunService': ''
      //   }
      // },


    }

  },
})
